package com.dddpeter.app.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dddpeter.app.entity.ArticleLike;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 文章点赞Mapper接口
 */
@Mapper
public interface ArticleLikeMapper extends BaseMapper<ArticleLike> {
    
    /**
     * 检查用户是否已点赞该文章
     */
    @Select("SELECT COUNT(*) FROM article_likes WHERE article_id = #{articleId} AND nickname = #{nickname}")
    int checkLikeExists(@Param("articleId") Long articleId, @Param("nickname") String nickname);
}
